<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>文案生成工具2</title>
    <script type="text/javascript" src="./js/vue.js"></script>
    <script type="text/javascript" src="./data/wenan.js"></script>
    <script type="text/javascript" src="./data/anli.js"></script>
    <script type="text/javascript" src="./data/youshi.js"></script>
    <script type="text/javascript" src="./data/aizhaoshang.js"></script>
    <script type="text/javascript" src="./data/laopingtai.js"></script>
    <script type="text/javascript" src="./data/826.js"></script>
    <script type="text/javascript" src="./data/909.js"></script>
    <script type="text/javascript" src="./data/910.js"></script>
  </head>
  <body>
    <div id="app">
      <span
        v-for="(item,index) in wenanList"
        :key="index"
        style="padding-right: 10px"
      >
        <button @click="changeWenan(item,index)">{{item.name}}</button>
      </span>
      文案个数：<input v-model="wenanNum">
      <h3 v-show="mbshow">《模板文案》</h3>
      <div id="wenanContent" v-html="nowWenan.wenan"></div>
      <hr />
      <hr />
      <br />
      <br />
      <br />
      <div style="float:left;width: 600px;">
        <div v-for="(item,index) in wenanText">
          <div v-html="item" style="font-size: 12px"></div>
          <br />
          <br />
          <br />
        </div>
      </div>

      <div style="float:right;width: 600px;">
        <div v-for="(item,index) in wenanText2">
          <div v-html="item" style="font-size: 12px"></div>
          <br />
          <br />
          <br />
        </div>
      </div>
    </div>

    <script>
      new Vue({
        el: "#app", // Vue 实例挂载的元素
        data: {
          mbshow: false,
          wenanList: [],
          nowWenan: {},
          anliList: [],
          wenanNum: 100,
          youshiList: [],
          kaitouList: [],
          pingtaiList: [],
          jieshaoList: [],
          liangdianList: [],
          qushiList: [],
          XMyoushiList: [],
          wenanText: [],
          wenanText2: [],
          L_kaitouList: [],
          L_kaitou2List: [],
          L_kechengList: [],
          L_gongnengList: [],
          L_fuwuList: [],
          L_jieweiList: [],
          L_jiazhiList: [],
          // 826文案
          kaitou_826: [],
          xiangmu_826: [],
          xuqiu_826: [],
          jieshao_826: [],
          liangdian_826: [],
          XMyoushi_826: [],
          jiewei_826: [],
          // 909文案
          kaitou_909: [],
          xiangmu_909: [],
          xuqiu_909: [],
          jieshao_909: [],
          liangdian_909: [],
          XMyoushi_909: [],
          jiewei_909: [],
        },
        methods: {
          changeWenan(item, index) {
            this.mbshow = true;
            this.wenanText = [];
            this.wenanText2 = [];
            this.nowWenan = item;
            if (index == 0) {
              var numList = [];
              for (let index = 0; index < 50; index++) {
                var num1 = Math.floor(Math.random() * this.youshiList.length);
                var num2 = num1;
                while (num1 == num2) {
                  num2 = Math.floor(Math.random() * this.youshiList.length);
                }
                console.log(num1, num2);
                numList.push(num1);
                var Text = this.nowWenan.wenan.replace(
                  "【优势一】",
                  this.youshiList[num1]
                );
                Text = Text.replace("【优势二】", this.youshiList[num2]);
                console.log(this.youshiList[num1], num1, Text);
                this.wenanText.push(Text);
              }
              console.log(numList);
              // this.youshiList.forEach((element,index) => {
              //     var Text =this.nowWenan.wenan.replace("【优势一】", element);
              //     console.log(Text)
              //     this.wenanText.push(Text)
              // });
            }
            if (index == 1) {
              for (let index = 0; index < this.wenanNum; index++) {
                var Text1 = this.randomData(this.kaitouList);
                var Text2 = this.randomData(this.pingtaiList);
                var Text3 = this.randomData(this.jieshaoList);
                var Text4 = this.randomData(this.liangdianList);
                var Text5 = this.randomData(this.qushiList);
                var num1 = Math.floor(Math.random() * this.XMyoushiList.length);
                var num2 = num1;
                while (num1 == num2) {
                  num2 = Math.floor(Math.random() * this.XMyoushiList.length);
                }
                var Text6 = this.randomData(this.XMyoushiList[num1]);
                var Text7 = this.randomData(this.XMyoushiList[num2]);
                var Text = this.nowWenan.wenan
                  .replace("【开头】", Text1)
                  .replace("【平台】", Text2)
                  .replace("【介绍】", Text3)
                  .replace("【亮点】", Text4)
                  .replace("【趋势】", Text5)
                  .replace("【项目优势1】", Text6)
                  .replace("【项目优势2】", Text7);
                if (Text4.includes("70%") && Text6.includes("70%")) {
                  console.log(Text);
                } else if (Text4.includes("70%") && Text7.includes("70%")) {
                  console.log(Text);
                } else {
                  this.wenanText.push(Text);
                }
                console.log(Text);
              }
            }
            if (index == 2) {
              for (let index = 0; index < this.wenanNum; index++) {
                var Text1 = this.randomData(this.L_kaitouList);
                var Text2 = this.randomData(this.L_kechengList);
                var Text3 = this.randomData(this.L_gongnengList);
                var Text4 = this.randomData(this.L_fuwuList);
                var Text5 = this.randomData(this.L_jieweiList);
                var num1 = Math.floor(Math.random() * this.L_jiazhiList.length);
                var num2 = num1;
                var num3 = num1;
                while (num2 == num1 || num2 == num3) {
                  num2 = Math.floor(Math.random() * this.L_jiazhiList.length);
                }
                while (num3 == num1 || num3 == num2) {
                  num3 = Math.floor(Math.random() * this.L_jiazhiList.length);
                }
                console.log(num1, num2, num3);
                var Text6 = this.randomData(this.L_jiazhiList[num1]);
                var Text7 = this.randomData(this.L_jiazhiList[num2]);
                var Text8 = this.randomData(this.L_jiazhiList[num3]);
                var num4 = Math.floor(Math.random() * this.anliList.length);
                var Text9 = this.randomData(this.anliList[num4]);
                var Text = this.nowWenan.wenan
                  .replace("【开头】", Text1)
                  .replace("【课程】", Text2)
                  .replace("【功能】", Text3)
                  .replace("【服务】", Text4)
                  .replace("【结尾】", Text5)
                  .replace("【价值1】", Text6)
                  .replace("【价值2】", Text7)
                  .replace("【价值3】", Text8)
                  .replace("【案例】", Text9);
                this.wenanText.push(Text);
                console.log(Text);
              }
            }
            if (index == 3) {
              for (let index = 0; index < this.wenanNum; index++) {
                var Text1 = this.randomData(this.L_kaitou2List);
                var Text2 = this.randomData(this.L_kechengList);
                var Text5 = this.randomData(this.L_jieweiList);
                var num1 = Math.floor(Math.random() * this.L_jiazhiList.length);
                var num2 = num1;
                var num3 = num1;
                while (num2 == num1 || num2 == num3) {
                  num2 = Math.floor(Math.random() * this.L_jiazhiList.length);
                }
                while (num3 == num1 || num3 == num2) {
                  num3 = Math.floor(Math.random() * this.L_jiazhiList.length);
                }
                console.log(num1, num2, num3);
                var Text6 = this.randomData(this.L_jiazhiList[num1]);
                var Text7 = this.randomData(this.L_jiazhiList[num2]);
                var Text8 = this.randomData(this.L_jiazhiList[num3]);
                var num4 = Math.floor(Math.random() * this.anliList.length);
                var Text9 = this.randomData(this.anliList[num4]);
                var Text = this.nowWenan.wenan
                  .replace("【开头二】", Text1)
                  .replace("【案例】", Text9)
                  .replace("【课程】", Text2)
                  .replace("【价值1】", Text6)
                  .replace("【价值2】", Text7)
                  .replace("【价值3】", Text8)
                  .replace("【结尾】", Text5);
                this.wenanText.push(Text);
                console.log(Text);
              }
            }
            if (index == 4) {
              for (let index = 0; index < this.wenanNum; index++) {
                var Text1 = this.randomData(this.kaitou_826);
                var Text2 = this.randomData(this.xiangmu_826);
                var Text3 = this.randomData(this.xuqiu_826);
                var Text4 = this.randomData(this.jieshao_826);
                var Text5 = this.randomData(this.liangdian_826);
                var Text6 = this.randomData(this.XMyoushi_826);
                var Text7 = this.randomData(this.jiewei_826);

                var num1 = Math.floor(Math.random() * this.XMyoushi_826.length);
                var num2 = num1;
                var num3 = num1;
                while (num2 == num1 || num2 == num3) {
                  num2 = Math.floor(Math.random() * this.XMyoushi_826.length);
                }
                while (num3 == num1 || num3 == num2) {
                  num3 = Math.floor(Math.random() * this.XMyoushi_826.length);
                }
                console.log(num1, num2, num3);
                var Text8 = this.randomData(this.XMyoushi_826[num1]);
                var Text9 = this.randomData(this.XMyoushi_826[num2]);
                var Text10 = this.randomData(this.XMyoushi_826[num3]);

                var Text = this.nowWenan.wenan
                  .replace("【开头】", Text1)
                  .replace("【项目】", Text2)
                  .replace("【需求】", Text3)
                  .replace("【介绍】", Text4)
                  .replace("【亮点】", Text5)
                  .replace("【项目优势1】", Text8)
                  .replace("【项目优势2】", Text9)
                  .replace("【项目优势3】", Text10)
                  .replace("【结尾】", Text7);
                const Text_4 = Text.replace(/\//g, "")
                this.wenanText.push(Text_4);

                const Text_2 =  Text.replace(/<br\/>/g, "/");
                const Text_3 =Text_2.replace(/\//g, "<br/>").replace(/\，/g, "<br/>").replace(/\。/g, "<br/>").replace(/<br\/><br\/>/g, "<br/>");
                this.wenanText2.push(Text_3);
                console.log(Text_3);
              }
            }
            if (index == 5) {
              for (let index = 0; index < this.wenanNum; index++) {
                var Text1 = this.randomData(this.kaitou_909);
                var Text2 = this.randomData(this.xiangmu_909);
                var Text3 = this.randomData(this.xuqiu_909);
                var Text4 = this.randomData(this.jieshao_909);
                var Text5 = this.randomData(this.liangdian_909);
                var Text6 = this.randomData(this.XMyoushi_909);
                var Text7 = this.randomData(this.jiewei_909);

                var num1 = Math.floor(Math.random() * this.XMyoushi_909.length);
                var num2 = num1;
                var num3 = num1;
                while (num2 == num1 || num2 == num3) {
                  num2 = Math.floor(Math.random() * this.XMyoushi_909.length);
                }
                while (num3 == num1 || num3 == num2) {
                  num3 = Math.floor(Math.random() * this.XMyoushi_909.length);
                }
                console.log(num1, num2, num3);
                var Text8 = this.randomData(this.XMyoushi_909[num1]);
                var Text9 = this.randomData(this.XMyoushi_909[num2]);
                var Text10 = this.randomData(this.XMyoushi_909[num3]);

                var Text = this.nowWenan.wenan
                  .replace("【开头】", Text1)
                  .replace("【项目】", Text2)
                  .replace("【需求】", Text3)
                  .replace("【介绍】", Text4)
                  .replace("【亮点】", Text5)
                  .replace("【项目优势1】", Text8)
                  .replace("【项目优势2】", Text9)
                  .replace("【项目优势3】", Text10)
                  .replace("【结尾】", Text7);
                
                const Text_4 = Text.replace(/\//g, "")
                this.wenanText.push(Text_4);
                
                const Text_2 =  Text.replace(/<br\/>/g, "/");
                const Text_3 =Text_2.replace(/\//g, "<br/>").replace(/\，/g, "<br/>").replace(/\。/g, "<br/>").replace(/<br\/><br\/>/g, "<br/>");
                this.wenanText2.push(Text_3);
                console.log(Text_3);
              }
            }
            if (index == 6) {
              for (let index = 0; index < this.wenanNum; index++) {
                var Text1 = this.randomData(kaitou_910);
                var Text2 = this.randomData(cpjieshao_910);
                var Text3 = this.randomData(kecheng_910);
                var Text4 = this.randomData(fuwu_910);
                var Text5 = this.randomData(gzliucheng_910);

                var num1 = Math.floor(Math.random() * liangdian_910.length);
                var num2 = num1;
                var num3 = num1;
                while (num2 == num1 || num2 == num3) {
                  num2 = Math.floor(Math.random() * liangdian_910.length);
                }
                while (num3 == num1 || num3 == num2) {
                  num3 = Math.floor(Math.random() * liangdian_910.length);
                }
                console.log(num1, num2, num3);
                var Text8 = this.randomData(liangdian_910[num1]);
                var Text9 = this.randomData(liangdian_910[num2]);
                var Text10 = this.randomData(liangdian_910[num3]);
                

                var Text = this.nowWenan.wenan
                  .replace("【开头】", Text1)
                  .replace("【产品介绍】", Text2)
                  .replace("【课程】", Text3)
                  .replace("【落地服务】", Text4)
                  .replace("【工作流程】", Text5)
                  .replace("【亮点1】", Text8)
                  .replace("【亮点2】", Text9)
                var randomValue = Math.random();
                if(randomValue < 0.5){
                  Text = Text.replace("【亮点3】", Text10)
                }else{
                  Text = Text.replace("【亮点3】<br/>", '')
                }
                  // .replace("【结尾】", Text7);
                const Text_4 = Text.replace(/\//g, "")
                this.wenanText.push(Text_4);
                
                const Text_2 =  Text.replace(/<br\/>/g, "/");
                const Text_3 =Text_2.replace(/\//g, "<br/>").replace(/\，/g, "<br/>").replace(/\。/g, "<br/>").replace(/<br\/><br\/>/g, "<br/>");
                this.wenanText2.push(Text_3);
                console.log(Text_3);
              }
            }
            this.$forceUpdate();
          },
          huanHang(data) {
            console.log(data);
            var Text = data.replace(/\//g, "<br/>").replace(/\，/g, "<br/>").replace(/\。/g, "<br/>");
            return Text;
          },
          randomData(data) {
            var num = Math.floor(Math.random() * data.length);
            var data1 = data[num];
            // if (typeof data1 === "string") {
            //   const data2 = this.huanHang(data1);
            //   return data2;
            // } else {
            return data1;
            // }
          },
        },
        mounted() {
          this.wenanList = wenan.wenanList;
          this.youshiList = youshi;
          this.kaitouList = kaitou;
          this.pingtaiList = pingtai;
          this.jieshaoList = jieshao;
          this.liangdianList = liangdian;
          this.qushiList = qushi;
          this.XMyoushiList = XMyoushi;
          this.L_kaitouList = L_kaitou;
          this.L_kaitou2List = L_kaitou2;
          this.L_kechengList = L_kecheng;
          this.L_gongnengList = L_gongneng;
          this.L_fuwuList = L_fuwu;
          this.L_jieweiList = L_jiewei;
          this.L_jiazhiList = L_jiazhi;
          this.anliList = L_anli;

          this.kaitou_826 = kaitou_826;
          this.xiangmu_826 = xiangmu_826;
          this.xuqiu_826 = xuqiu_826;
          this.jieshao_826 = jieshao_826;
          this.liangdian_826 = liangdian_826;
          this.XMyoushi_826 = XMyoushi_826;
          this.jiewei_826 = jiewei_826;

          this.kaitou_909 = kaitou_909;
          this.xiangmu_909 = xiangmu_909;
          this.xuqiu_909 = xuqiu_909;
          this.jieshao_909 = jieshao_909;
          this.liangdian_909 = liangdian_909;
          this.XMyoushi_909 = XMyoushi_909;
          this.jiewei_909 = jiewei_909;

          console.log(this.wenanList, this.anliList, this.youshiList);
        },
      });
    </script>
  </body>
</html>
